package com.egao.common.module.marketPush.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.egao.common.core.web.PageParam;
import com.egao.common.module.marketPush.entity.MarketPushRecord;
import com.egao.common.module.marketPush.mapper.MarketPushRecordMapper;
import com.egao.common.module.marketPush.param.MarketPushRecordExport;
import com.egao.common.module.marketPush.service.MarketPushRecordService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lym
 * @date 2024/5/27 14:48
 */
@Service
public class MarketPushRecordServiceImpl extends ServiceImpl<MarketPushRecordMapper, MarketPushRecord> implements MarketPushRecordService {

    @Override
    public List<MarketPushRecord> listPage(PageParam<MarketPushRecord> page) {
        Integer marketPushId = page.getInt("marketPushId");
        String xh = page.getString("xh");
        PageParam<MarketPushRecord> param = baseMapper.selectPage(page,
                new QueryWrapper<MarketPushRecord>()
                        .eq("market_push_id", marketPushId)
                        .eq(!StrUtil.isBlank(xh), "xh", xh)
        );
        return param.getRecords();
    }

    @Override
    public List<MarketPushRecordExport> exportList(Integer marketPushId) {
        return baseMapper.exportList(marketPushId);
    }
}
